#!/usr/bin/perl -w
use MIME::Lite; 
my $path="/home/trening/data/public_html/cgi-bin/";
#system("mysqldump -hlocalhost -uddumper -pddumper sms trening trening_history trening_agenda > ${path}trening.sql");

open(CRLOG,">>${path}crlog.txt");


system("/usr/local/bin/mysqldump  -hlocalhost -uss77ru -p662720 ss77ru > ${path}trening.sql");

system("/usr/local/bin/mysqldump  -hlocalhost -uss77ru -p662720 real > ${path}real.sql");


system ("/usr/local/bin/zip -P nhtybyutp ${path}trening.zip ${path}trening.sql  ${path}real.sql");


my $msg = MIME::Lite->new( From => 'trening_yes@bk.ru', 
To => 'treningyes@gmail.com', 
Subject => 'base', 
Type => 'multipart/mixed', ); 
$msg->attach( Type => 'TEXT', 
Data => "database", ); 
$msg->attr("content-type.charset" => "window-1251");

$msg->attach( Type => 'application/zip', 
Path => "${path}trening.zip", 
Filename => 'trening.zip', ); 
$msg->send or print CRLOG "error send  $@";

system("rm ${path}trening.zip");

